<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../css/jquery-weui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../css/login.css" />
    <link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_425307_aq150n9pewcj714i.css" />
    <title>登录</title>
    <script src="../../js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/baseConfig.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>
    <!--<div id="header">

		</div>-->
    <div class="weui-cells weui-cells_form" style="margin-top: 0;">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">账号</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input accountNumber" type="text" placeholder="请输入账号">
            </div>
        </div>
        <div class="weui-cell ">
            <div class="weui-cell__hd">
                <label class="weui-label">密码</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input passWord" type="password" placeholder="请输入密码">
            </div>
        </div>
    </div>
    <div class="forgetPassword">
        <a href="forgetPassword.html">忘记密码</a>
    </div>
    <!--<div class="demos-content-padded">
			<a href="javascript:;" class="weui-btn weui-btn_primary">按钮</a>
		</div>-->
    <div class="demos-content-padded">
        <!--<a href="register.html" class="weui-btn weui-btn_mini weui-btn_default Register" style="float: left;">注册</a>-->
        <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary Login" style="float: right;margin-top: 0;background: #28c81e;width: 100%;">登录</a>
    </div>
</body>
<script type="text/javascript">
    $(document).ready(function() {
        $("#header").load('../common/header.html', function() {
            //				$(".header-title").css("background", "#fff")
            //				$(".header-title span").html("登录")
            //				$("#header .iconfont").css("display", "inline-block")
            //				$(".header-title .left").on("click", function() {
            //					history.back()
            //				})
        });
        $(".Login").on("click", function() { //点击登录
            var accountNumber = $(".accountNumber").val(); //账号
            var passWord = $(".passWord").val(); //密码
            if (!accountNumber) {
                $.toptip('账号不能为空', 1200, 'error');
            } else {
                //					var reg = new RegExp(/^1[34578]\d{9}$/);
                //					if(!reg.test(accountNumber) || accountNumber.length != 11) {
                //						$.toptip('请输入正确的手机号', 1200, 'error');
                //					} else {
                if (!passWord) {
                    $.toptip('密码不能为空', 1200, 'error');
                } else {
                    $.ajax({ //判断当前手机号是否注册过
                        method: 'get',
                        url: baseConfig.localHttp + "weChatApi/login/login",
                        data: {
                            username: accountNumber,
                            password: passWord
                        },
                        headers: {
                            'Content-Type': 'application/x-www-form-urlencoded'
                        },
                        success: function(data) {
                            console.log(data)
                            if (data.code == 100) {
                                localStorage.setItem("username", accountNumber)
                                localStorage.setItem("SupplierId", data.content.id)
                                localStorage.setItem("name", data.content.name)
                                localStorage.setItem("scopeBusinessNames", data.content.scopeBusinessNames)
                                localStorage.setItem("hanSui", data.content.isHanshui)
                                localStorage.setItem("tranType", data.content.tranType)
                                $.toptip("登录成功", 1200, 'success')
                                setTimeout(function(){
                                	 baseConfig.getCode()
                                },1200)                          
                                    //									location.href = "../mine/mine.html"
                            } else {
                                $.toptip(data.content, 1200, 'error');
                            }
                        },
                        error: function() {

                        }
                    })
                }
            }
        })
    })
</script>

</html>